#ifndef __G_COMPONENT_H__
#define __G_COMPONENT_H__

#include <string>
#include <vector>

#include "GCoordFrame3D.h"
#include "GBoxAAligned.h"
#include "GTypes.h"
#include "GInitializable.h"

namespace GEngine
{

	enum GComponentType
	{
		G_CT_CUSTOM		= 0,
		G_CT_CULL		= 1 << 1,
		G_CT_MESH		= 1 << 2,
		G_CT_PHYSIC		= 1 << 3,
		G_CT_NETWORK	= 1 << 4,
		G_CT_SCRIPT		= 1 << 5,
		G_CT_GRAPHIC	= 1 << 6,
		G_CT_SOUND		= 1 << 7,
		G_CT_ANIMATION	= 1 << 8,
		G_CT_TRANSFORM	= 1 << 9,
		G_CT_STATE		= 1 << 10,
		G_CT_AI			= 1 << 11,
	};

	class GGameObject;

	class GComponent : public GUtil::GInitializable
	{
	friend class GGameObject;

	private:
		std::string			Name;
		
		GGameObject*		Owner;
		
		GComponentType		Type;

		bool				Active;
		bool				MultiTasked;

	protected:
							GComponent();
		virtual				~GComponent();

		virtual void		OnAtach();
		virtual void		OnDetach();

	public:
		GGameObject*		GetOwner() const;
		GComponentType		GetType() const;

		void				SetActive(bool Value);
		bool				GetActive() const;

		void				SetName(const char* CompName);
		const char*			GetName() const;

		virtual bool		Update(float FrameTime);
		virtual bool		UpdateLate(float FrameTime);
		virtual bool		UpdateFixed(float FrameTime);
	};
}

#endif